/**
 * \class GenIdentExp.h /GenProg/AbsSyn/GenExpClasses/GenIdentExp.h
 *
 *  \date 22 maj 2012
 *  \author ytc0039
 *  
 *  \brief 
 */

#ifndef GENIDENTEXP_H_
#define GENIDENTEXP_H_
#include <Interfaces/IGenExp.h>
#include <Generator/GenIdent.h>
#include <AbsSyn/AbsSyn.h>
#include <AbsSyn/IdentExp.h>


class GenIdentExp : public IGenExp
{
private:
	const GenIdent& m_GenClass;

public:
	explicit GenIdentExp(const GenIdent& genClass):
	m_GenClass(genClass)
	{

	}

	virtual AbsSyn::IExpPtr genExp(GenExp::GenExpPtr genExpPtr) const
	{
		//Use the generator to create a new Ident this ident
		// will be used to create a Ident expression
		AbsSyn::IdentPtr identPtr(m_GenClass.genIdent());
		AbsSyn::IExpPtr ptr( new IdentExp( identPtr.get() ) );
		return ptr;
	}

	virtual int getExpNrArg() const
	{
		return 0;
	}

	/**
	 *  \brief Does the type match the expression
	 *
	 *  When the generator creates a new expression
	 *  it is necessary to know if the type matches
	 *  the chosen expression.
	 *  For Ident this is not really chosen here since
	 *  it depends on what it has been assigned in the context.
	 *  So it always returns true.
	 *
	 * @param type
	 * @return true if it matches
	 */
	virtual bool isTypeMatch(TypeEnum type) const{
		return true;
	}
};

#endif /* GENIDENTEXP_H_ */
